package com.yunxin.admin.system.application.assembler;

import com.yunxin.admin.system.application.command.AddMenuCommand;
import com.yunxin.admin.system.application.command.UpdateMenuCommand;
import com.yunxin.admin.system.application.dto.MenuDTO;
import com.yunxin.admin.system.application.dto.MenuInfoDTO;
import com.yunxin.admin.system.domain.model.menu.Menu;
import com.yunxin.admin.system.infra.persistence.entity.SysMenuDO;
import org.mapstruct.InheritInverseConfiguration;
import org.mapstruct.Mapper;

/**
 * 菜单对象转换器
 *
 * @author zero°
 * @since 2023-05-22
 */
@Mapper(componentModel = "spring")
public interface MenuAssembler {
    /**
     * entity 转 dto
     * @param entity entity
     * @return MenuDTO
     */
    MenuDTO toMenuDTO(SysMenuDO entity);

    /**
     * entity 转 dto
     * @param entity entity
     * @return DictInfoDTO
     */
    MenuInfoDTO toMenuInfoDTO(SysMenuDO entity);
    /**
     * command 转 entity
     * @param command command
     * @return Menu
     */
    Menu formAddMenuCommand(AddMenuCommand command);
    /**
     * command 转 entity
     * @param command command
     * @return SysDictType
     */
    @InheritInverseConfiguration(name="toMenuInfoDTO")
    Menu formUpdateMenuCommand(UpdateMenuCommand command);

}